#ifndef _ENGINE
#define _ENGINE

#include "config.hpp"
#include "itoken.hpp"
#include "ingdirect_it.hpp"

class engine: public itoken
{
public:	

	engine(const char* _config_filename);
	
	std::string const read(unsigned short* _index_ptr=(unsigned short*)0);
	std::string const read(std::vector<unsigned short> const& _substring_indices);

	void write(const char* _token='\0');
	void write(const char* _filename, bool _just_one_char_per_page);
	void write(const char* _filename, std::vector<unsigned short> const& _substring_indices, bool _just_one_char_per_page=true);
	
	config const get_config() const;
	std::string const get_keypad_config_filename() const;

	engine& operator=(engine const& _tk);
	static const std::string get_basename(const char* _filename, bool _add_timestamp = true);
	const std::string get_default_exportfile() const;

private:		

	config _config;
};



class ingdirect_tk
{
public:
	ingdirect_tk(const char* ingdirect_filename);

	const std::string set_ingdirect_pinpad_coordinates(std::string const&, std::string const &pinpad_sequence, std::string const& pin_layout, unsigned short* _index_ptr =(unsigned short*)0 );
	static const std::string get_input_sequence(const char** _msg, unsigned short _len=10);
	ingdirect_it const& get_ingdirect_conf();

	static std::string const get_pinpad_sequence();
	static std::string const get_pin_layout();
	
	static bool wait_ready_state_interactive();

private:
	ingdirect_it _ingdirect;
	
};

#endif
